<!--
* description: 索赔申诉审核-索赔申诉
* author: hezhiming
* createdDate:2021-4-9
-->
<template>
  <section class="editSetBelowAdd">
    <el-dialog
      v-dialogDrag
      :visible.sync="curPopupsVisible"
      :title="textMap[popupsState]"
      :append-to-body="true"
      width="70%"
      :close-on-click-modal="false"
      @close="closeEdit"
      @open="open"
    >
      <dialogHeader
        slot="title"
        :title="textMap[popupsState]"
        :style-type="$store.state.app.dialogType"
      />

      <div class="btns-container">
        <el-button v-for="item in formButtons" :key="item.comKey" :type="item.type" @click="item.clickEvent">
          {{ item.text }}
        </el-button>
      </div>

      <div class="filter-container filter-title">索赔单信息</div>
      <div class="filter-container filter-params">
        <el-row ref="vailComponentList1" :gutter="26">
          <component
            :is="comp.component"
            v-for="comp in tableComponents1.filter((o) => o.isMust === true)"
            :ref="comp.isRequire ? comp.isRequire + comp.compKey : comp.compKey"
            :key="comp.compKey"
            :validrule="comp.validrule"
            :code-field="comp.codeField"
            :text-field="comp.textField"
            :popups-key="comp.compKey"
            :parent-fileds="comp.parentFileds"
            :code="formField[comp.codeField]"
            :disabled="comp.disabled"
            :o-fields="comp.oFields"
            :options="comp.options"
            :custom-obj="comp.customObj"
            :is-require="comp.isRequire"
            :is-mul="comp.isMul"
            :span="comp.span || 8"
            :label-name="comp.labelName"
            :lookuptype="comp.lookuptype"
            :date-options-type="comp.dateOptionsType"
            @changeCode="getComponentCode"
            @focusCode="getFocusCode"
          />
        </el-row>
      </div>

      <div class="filter-container filter-title">车辆信息</div>
      <div class="filter-container filter-params">
        <el-row ref="vailComponentList2" :gutter="26">
          <component
            :is="comp.component"
            v-for="comp in tableComponents2.filter((o) => o.isMust === true)"
            :ref="comp.isRequire ? comp.isRequire + comp.compKey : comp.compKey"
            :key="comp.compKey"
            :validrule="comp.validrule"
            :code-field="comp.codeField"
            :text-field="comp.textField"
            :popups-key="comp.compKey"
            :parent-fileds="comp.parentFileds"
            :code="formField[comp.codeField]"
            :disabled="comp.disabled"
            :o-fields="comp.oFields"
            :options="comp.options"
            :custom-obj="comp.customObj"
            :is-require="comp.isRequire"
            :is-mul="comp.isMul"
            :span="comp.span || 8"
            :label-name="comp.labelName"
            :lookuptype="comp.lookuptype"
            :date-options-type="comp.dateOptionsType"
            @changeCode="getComponentCode"
            @focusCode="getFocusCode"
          />
        </el-row>
      </div>

      <div class="filter-container filter-title">客户信息</div>
      <div class="filter-container filter-params">
        <el-row ref="vailComponentList3" :gutter="26">
          <component
            :is="comp.component"
            v-for="comp in tableComponents3.filter((o) => o.isMust === true)"
            :ref="comp.isRequire ? comp.isRequire + comp.compKey : comp.compKey"
            :key="comp.compKey"
            :validrule="comp.validrule"
            :code-field="comp.codeField"
            :text-field="comp.textField"
            :popups-key="comp.compKey"
            :parent-fileds="comp.parentFileds"
            :code="formField[comp.codeField]"
            :disabled="comp.disabled"
            :o-fields="comp.oFields"
            :options="comp.options"
            :custom-obj="comp.customObj"
            :is-require="comp.isRequire"
            :is-mul="comp.isMul"
            :span="comp.span || 8"
            :label-name="comp.labelName"
            :lookuptype="comp.lookuptype"
            :date-options-type="comp.dateOptionsType"
            @changeCode="getComponentCode"
            @focusCode="getFocusCode"
          />
        </el-row>
      </div>

      <div class="filter-container filter-title">申诉信息</div>
      <div class="filter-container filter-params">
        <el-row ref="vailComponentList4" :gutter="26">
          <component
            :is="comp.component"
            v-for="comp in tableComponents4.filter((o) => o.isMust === true)"
            :ref="comp.isRequire ? comp.isRequire + comp.compKey : comp.compKey"
            :key="comp.compKey"
            :validrule="comp.validrule"
            :code-field="comp.codeField"
            :text-field="comp.textField"
            :popups-key="comp.compKey"
            :parent-fileds="comp.parentFileds"
            :code="formField[comp.codeField]"
            :disabled="comp.disabled"
            :o-fields="comp.oFields"
            :options="comp.options"
            :custom-obj="comp.customObj"
            :is-require="comp.isRequire"
            :is-mul="comp.isMul"
            :span="comp.span || 8"
            :label-name="comp.labelName"
            :lookuptype="comp.lookuptype"
            :date-options-type="comp.dateOptionsType"
            @changeCode="getComponentCode"
            @focusCode="getFocusCode"
          />
        </el-row>
      </div>

      <div class="filter-container filter-title">申诉附件信息</div>
      <div class="app-container app-container-table">
        <one-table-template
          ref="multipleTable"
          :dynamic-buttons="dynamicTableButtonsUpload"
          :dynamic-table-cols="tableCols5"
          :dynamic-api-config="apiConfig"
          :dynamic-form-fields="formField"
          :dynamic-is-init-table="true"
          :dynamic-is-show-select="true"
          :dynamic-is-show-more-btn="true"
          :dynamic-table-defult-height="200"
          :is-show-pagination="false"
          :callback-obj="callbackObj"
        />
      </div>

      <div class="filter-container filter-title">其他信息</div>
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="故障信息" name="first">
          <div class="filter-container filter-params">
            <el-row ref="vailComponentList5" :gutter="26">
              <component
                :is="comp.component"
                v-for="comp in tableComponents5.filter((o) => o.isMust === true)"
                :ref="comp.isRequire? comp.isRequire + comp.compKey: comp.compKey"
                :key="comp.compKey"
                :validrule="comp.validrule"
                :code-field="comp.codeField"
                :text-field="comp.textField"
                :popups-key="comp.compKey"
                :parent-fileds="comp.parentFileds"
                :code="formField[comp.codeField]"
                :disabled="comp.disabled"
                :o-fields="comp.oFields"
                :options="comp.options"
                :custom-obj="comp.customObj"
                :is-require="comp.isRequire"
                :is-mul="comp.isMul"
                :span="comp.span || 8"
                :label-name="comp.labelName"
                :lookuptype="comp.lookuptype"
                :date-options-type="comp.dateOptionsType"
                @changeCode="getComponentCode"
                @focusCode="getFocusCode"
              />
            </el-row>
          </div>
        </el-tab-pane>
        <el-tab-pane label="附件信息" name="second">
          <one-table-template
            ref="multipleTable5"
            :dynamic-buttons="dynamicTableButtons"
            :dynamic-table-cols="tableCols1"
            :dynamic-api-config="apiConfig"
            :dynamic-form-fields="formField"
            :dynamic-is-init-table="true"
            :dynamic-is-show-select="true"
            :dynamic-is-show-more-btn="true"
            :dynamic-table-defult-height="200"
            :is-show-pagination="false"
          />
        </el-tab-pane>
        <el-tab-pane label="索赔工时" name="third">
          <one-table-template
            ref="multipleTable1"
            :dynamic-table-cols="tableCols"
            :dynamic-api-config="apiConfig"
            :dynamic-form-fields="formField"
            :dynamic-is-init-table="true"
            :dynamic-is-show-select="false"
            :dynamic-is-show-more-btn="true"
            :dynamic-table-defult-height="200"
            :is-show-pagination="false"
          />
        </el-tab-pane>
        <el-tab-pane label="索赔备件" name="fourth">
          <one-table-template
            ref="multipleTable2"
            :dynamic-table-cols="tableCols2"
            :dynamic-api-config="apiConfig"
            :dynamic-form-fields="formField"
            :dynamic-is-init-table="true"
            :dynamic-is-show-select="false"
            :dynamic-is-show-more-btn="true"
            :dynamic-table-defult-height="200"
            :is-show-pagination="false"
          />
        </el-tab-pane>
        <el-tab-pane label="索赔其他项目" name="fiveth">
          <one-table-template
            ref="multipleTable3"
            :dynamic-table-cols="tableCols3"
            :dynamic-api-config="apiConfig"
            :dynamic-form-fields="formField"
            :dynamic-is-init-table="true"
            :dynamic-is-show-select="false"
            :dynamic-is-show-more-btn="true"
            :dynamic-table-defult-height="200"
            :is-show-pagination="false"
          />
        </el-tab-pane>
        <el-tab-pane label="审核信息" name="sixth">
          <one-table-template
            ref="multipleTable4"
            :dynamic-table-cols="tableCols4"
            :dynamic-api-config="apiConfig"
            :dynamic-form-fields="formField"
            :dynamic-is-init-table="true"
            :dynamic-is-show-select="false"
            :dynamic-is-show-more-btn="true"
            :dynamic-table-defult-height="200"
            :is-show-pagination="false"
          />
        </el-tab-pane>
      </el-tabs>
    </el-dialog>
    <!-- 审核意见弹框 -->
    <el-dialog
      v-dialogDrag
      :visible.sync="dialogFormVisible"
      title="审核意见"
      :append-to-body="true"
      width="30%"
      :close-on-click-modal="false"
      @close="closeBack"
    >
      <dialogHeader
        slot="title"
        title="审核意见"
        :style-type="$store.state.app.dialogType"
      />
      <one-table-template
        ref="multipleTable1"
        :dynamic-buttons="tableButtons1"
        :dynamic-components="tableComponents6"
        :dynamic-form-fields="formField6"
        :dynamic-is-init-table="true"
        :dynamic-is-show-select="false"
        :dynamic-is-show-more-btn="true"
        :dynamic-table-defult-height="200"
        :is-show-pagination="false"
      />
    </el-dialog>
  </section>
</template>
<script>
import { oneTableWithViewTemplateMixins } from '@/components/mixins/oneTableWithViewTemplateMixins'
import { formMixins } from '@/components/mixins/formMixins'
import OneTableTemplate from '@/components/templates/oneTable'
import { orgApis } from '@/api/caseManagementQuery'
import request from '@/utils/request'
import { setDynamicFieldsData } from '@/utils/dataOperation'

export default {
  components: {
    dialogHeader: () => import('@/components/dialogHeader'),
    OneTableTemplate
  },
  // 组件混入对象
  mixins: [oneTableWithViewTemplateMixins, formMixins],

  props: {
    dynamicEditRowData: {
      type: Object,
      default: () => {
        return {}
      }
    },
    popupsState: { type: String },
    // 弹出是否显示
    popupsVisible: { type: Boolean, default: false }
  },

  data() {
    const viewPageCode = 'belowOrd-Edit'
    return {
      hideShow: 'flaw',
      num: 1,
      selectiondata: { list: [] },
      chooseList: [],
      editPopupsTime: false,
      dialogFormVisible: false,
      editRowData1: {},
      multable: 'multipleTable1',
      showBtn: '1', // 开关
      deleteTransferOrderDId: [],
      updateControlIdD: [],
      chooseList: [], // 索赔单选择传过来的数据
      dataRefs: ['truecompKey2', 'truecompKey3'],
      // apiConfig: api.queryExhibitionCarProductionByDetail,
      // 动态组件-按钮
      dynamicTableButtons: [
        {
          compKey: 'btnKey1',
          type: 'primary',
          size: 'small',
          name: 'preservation',
          clickEvent: () => this.addRow(),
          text: '下载',
          isShow: true
        }
      ],
      tableButtons1: [
        {
          compKey: 'btnKey2',
          type: 'primary',
          size: 'small',
          name: 'pass',
          clickEvent: () => this.submitTo(),
          text: '确认',
          position: 'right',
          fuzzySearch: true
        },
        {
          compKey: 'btnKey2',
          type: 'primary',
          size: 'small',
          name: 'pass',
          clickEvent: () => this.closeBack(),
          text: '取消',
          position: 'right',
          fuzzySearch: true
        }
      ],
      tableComponents6: [
        {
          compKey: 'key1',
          labelName: '审核意见:',
          codeField: 'auditMemo',
          lookuptype: 'VE0185',
          component: () => import('@/components/org/commonInput'),
          type: 'dropdownList',
          isMul: false,
          isMust: true,
          span: 15
        }
      ],
      formField6: {
        auditMemo: ''
      },
      dynamicTableButtonsUpload: [
        {
          compKey: 'btnKey1',
          type: 'primary',
          size: 'small',
          name: '',
          //   clickEvent: () => this.handFileListChange(),
          text: '下载',
          position: 'right',
          isShow: true
        }
      ],
      tableComponents:
        this.$ConfigCache.CacheConfig.cacheData[viewPageCode] &&
        this.$ConfigCache.CacheConfig.cacheData[viewPageCode].formComponents
          .length > 0
          ? this.$ConfigCache.CacheConfig.cacheData[viewPageCode].formComponents
          : [],
      // 动态组件-查询条件
      tableComponents1:
         [
           {
             compKey: 'compKey1',
             labelName: '门店编码：',
             codeField: 'dlrCode',
             component: () => import('@/components/org/commonInput'),
             type: 'inputText',
             disabled: true,
             isMul: false,
             isMust: true,
             span: 6
           },
           {
             compKey: 'compKey2',
             labelName: '门店名称：',
             codeField: 'dlrFullName',
             component: () => import('@/components/org/commonInput'),
             type: 'inputText',
             disabled: true,
             isMul: false,
             isMust: true,
             span: 6
           },
           {
             compKey: 'compKey3',
             labelName: '索赔单号：',
             codeField: 'claimCode',
             component: () => import('@/components/se/claimToChoose'),
             type: 'inputText',
             disabled: false,
             isMul: false,
             isMust: true,
             span: 6
           },
           {
             compKey: 'compKey4',
             labelName: '单据状态：',
             codeField: 'claimStatus',
             component: () => import('@/components/org/commonInput'),
             type: 'inputText',
             disabled: true,
             isMul: false,
             isMust: true,
             span: 6
           },
           {
             compKey: 'compKey5',
             labelName: '索赔员：',
             codeField: 'claimEmpNO',
             textField: 'cityName',
             oFields: 'cityId,cityName',
             customObj: {
               // api: apis.listOfCities,
               selectType: '1'
             },
             component: () => import('@/components/org/commonSelect'),
             type: 'dropdownList',
             isMust: true,
             disabled: true,
             span: 6
           },
           {
             compKey: 'compKey6',
             labelName: '索赔员电话：',
             codeField: 'linkManTel',
             component: () => import('@/components/org/commonInput'),
             type: 'inputText',
             disabled: true,
             isMul: false,
             isMust: true,
             span: 6
           },
           {
             compKey: 'compKey7',
             labelName: '索赔分类：',
             codeField: 'claimType',
             textField: 'cityName',
             oFields: 'cityId,cityName',
             customObj: {
               // api: apis.listOfCities,
               selectType: '1'
             },
             component: () => import('@/components/org/commonSelect'),
             type: 'dropdownList',
             isMust: true,
             disabled: true,
             span: 6
           },
           {
             compKey: 'compKey8',
             labelName: '活动编号：',
             codeField: 'actionCode',
             textField: 'cityName',
             oFields: 'cityId,cityName',
             customObj: {
               // api: apis.listOfCities,
               selectType: '1'
             },
             component: () => import('@/components/org/commonSelect'),
             type: 'dropdownList',
             isMust: true,
             disabled: true,
             span: 6
           },
           {
             compKey: 'compKey9',
             labelName: '索赔月份：',
             codeField: 'actionCode',
             component: () => import('@/components/org/commonInput'),
             type: 'inputText',
             disabled: true,
             isMul: false,
             isMust: true,
             span: 6
           },
           {
             compKey: 'compKey10',
             labelName: '提交日期：',
             codeField: 'submitDate',
             component: () =>
               import('@/components/org/datePicker/datePicker.vue'),
             type: 'inputText',
             disabled: true,
             isMul: false,
             isMust: true,
             span: 6
           },
           {
             compKey: 'compKey11',
             labelName: '运输费：',
             codeField: 'shipAmount',
             component: () => import('@/components/org/commonInput'),
             type: 'inputText',
             disabled: true,
             isMul: false,
             isMust: true,
             span: 6
           },
           {
             compKey: 'compKey12',
             labelName: '补偿意外费：',
             codeField: 'compAmount',
             component: () => import('@/components/org/commonInput'),
             type: 'inputText',
             disabled: true,
             isMul: false,
             isMust: true,
             span: 6
           },
           {
             compKey: 'compKey13',
             labelName: '工时费：',
             codeField: 'wiAmount',
             component: () => import('@/components/org/commonInput'),
             type: 'inputText',
             disabled: true,
             isMul: false,
             isMust: true,
             span: 6
           },
           {
             compKey: 'compKey14',
             labelName: '备件费：',
             codeField: 'partAmount',
             component: () => import('@/components/org/commonInput'),
             type: 'inputText',
             disabled: true,
             isMul: false,
             isMust: true,
             span: 6
           },
           {
             compKey: 'compKey15',
             labelName: '其他费用：',
             codeField: 'sumOtherAmount',
             component: () => import('@/components/org/commonInput'),
             type: 'inputText',
             disabled: true,
             isMul: false,
             isMust: true,
             span: 6
           },
           {
             compKey: 'compKey16',
             labelName: '总金额：',
             codeField: 'sumAmount',
             component: () => import('@/components/org/commonInput'),
             type: 'inputText',
             disabled: true,
             isMul: false,
             isMust: true,
             span: 6
           }
         ],

      tableComponents2: [
        {
          compKey: 'compKey1',
          labelName: '派工单号：',
          codeField: 'repairOrderCode',
          textField: 'repairOrderCode',
          component: () => import('@/components/se/sparePartNameCode'),
          type: 'inputText',
          disabled: true,
          isMust: true,
          isMul: false,
          span: 6
        },
        {
          compKey: 'compKey3',
          labelName: '车型：',
          codeField: 'carConfigCN',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey2',
          labelName: '车牌号：',
          codeField: 'carLicense',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey4',
          labelName: '进厂时间：',
          codeField: 'repairDate',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey5',
          labelName: '保修开始时间：',
          codeField: 'invoiceDate',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey6',
          labelName: '行驶里程：',
          codeField: 'mileage',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey7',
          labelName: '购件里程：',
          codeField: 'payMileage',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey8',
          labelName: '购件日期：',
          codeField: 'payDate',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey9',
          labelName: '保修申请单号：',
          codeField: 'preAuthorCode',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey10',
          labelName: 'VIN码：',
          codeField: 'VIN',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey11',
          labelName: '车辆用途：',
          codeField: 'buyCaruseCodeName',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey12',
          labelName: '生产日期：',
          codeField: 'produceDate',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey13',
          labelName: '前电机号：',
          codeField: 'engineCode',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey14',
          labelName: '后电机号：',
          codeField: 'engineCode2',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey15',
          labelName: '底盘号：',
          codeField: 'underpanNO',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey16',
          labelName: '变速箱号：',
          codeField: 'ectCode',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        }
      ],

      tableComponents3: [
        {
          compKey: 'compKey1',
          labelName: '车主姓名：',
          codeField: 'custName',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey2',
          labelName: '性别：',
          codeField: 'gender',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey3',
          labelName: '车主手机：',
          codeField: 'phone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey4',
          labelName: '省份：',
          codeField: 'addrPrivince',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey5',
          labelName: '城市：',
          codeField: 'addrCity',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey6',
          labelName: '区县：',
          codeField: 'addrCounty',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey7',
          labelName: '街道地址：',
          codeField: 'addrStreet',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 12
        },
        {
          compKey: 'compKey8',
          labelName: '送修人：',
          codeField: 'linkMan',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey9',
          labelName: '送修人电话：',
          codeField: 'linkManTels',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        }
      ],

      tableComponents4: [
        {
          compKey: 'compKey1',
          labelName: '申诉单号：',
          codeField: 'appealCode',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey2',
          labelName: '状态：',
          codeField: 'appealStatusName',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey3',
          labelName: '申诉原因：',
          codeField: 'reason',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: false,
          isMul: false,
          isMust: true,
          span: 24
        }
      ],

      tableComponents5: [
        {
          compKey: 'compKey',
          labelName: '故障类型：',
          codeField: 'custType',
          textField: 'cityName',
          oFields: 'cityId,cityName',
          customObj: {
            // api: apis.listOfCities,
            selectType: '1'
          },
          component: () => import('@/components/org/commonSelect'),
          type: 'dropdownList',
          isMust: true,
          disabled: true,
          span: 6
        },
        {
          compKey: 'compKey2',
          labelName: '故障件代码：',
          codeField: 'pfpCode',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey3',
          labelName: '故障件名称：',
          codeField: 'pfpName',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey4',
          labelName: '故障件日期：',
          codeField: 'faultTime',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey5',
          labelName: '故障现象码：',
          codeField: 'csCode',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        // {
        //   compKey: "compKey6",
        //   labelName: "故障原因码：",
        //   codeField: "",
        //   component: () => import("@/components/org/commonInput"),
        //   type: "inputText",
        //   disabled: true,
        //   isMul: false,
        //   isMust: true,
        //   span: 6,
        // },
        {
          compKey: 'compKey7',
          labelName: '故障部位：',
          codeField: 'faultPartCode',
          textField: 'cityName',
          oFields: 'cityId,cityName',
          customObj: {
            // api: apis.listOfCities,
            selectType: '1'
          },
          component: () => import('@/components/org/commonSelect'),
          type: 'dropdownList',
          isMust: true,
          disabled: true,
          span: 6
        },
        {
          compKey: 'compKey8',
          labelName: '故障数据：',
          codeField: 'faultDTC',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey9',
          labelName: '备注：',
          codeField: 'remark',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMust: true,
          span: 24
        },
        {
          compKey: 'compKey10',
          labelName: '故障描述：',
          codeField: 'custComplainCS',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMust: true,
          span: 24
        },
        {
          compKey: 'compKey11',
          labelName: '诊断过程：',
          codeField: 'detailCheckSynopsis',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMust: true,
          span: 24
        },
        {
          compKey: 'compKey12',
          labelName: '故障处理：',
          codeField: 'repairWay',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMust: true,
          span: 24
        }
      ],

      tableCols: [
        {
          prop: 'releaseId',
          label: '主键ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'updateControlIdO',
          label: '并发控制ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'updateControlIdOd',
          label: '并发控制ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'transferOrderId',
          label: '展车主单id',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'transferOrderDId',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'wiCode',
          label: '工时编码',
          align: 'center'
        },
        {
          prop: 'wiName',
          label: '维修内容',
          align: 'center'
        },
        {
          prop: 'wiQTY',
          label: '工时数',
          align: 'center'
        },
        {
          prop: 'wiPrice',
          label: '工时单价',
          align: 'center'
        },
        {
          prop: 'wiTotal',
          label: '费用合计',
          align: 'center'
        },
        {
          prop: 'claimWiCoef',
          label: '索赔系数',
          align: 'center'
        },
        {
          prop: 'isMain',
          label: '是否主工时',
          align: 'center'
        },
        {
          prop: 'remark2',
          label: '备注',
          align: 'center'
        }
      ],

      tableCols1: [
        {
          prop: 'fileName',
          label: '附件名称',
          align: 'center'
        },
        {
          prop: 'attachmentFilePath',
          label: '备注',
          align: 'center'
        }
      ],

      tableCols2: [
        {
          prop: 'releaseId',
          label: '主键ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'updateControlIdO',
          label: '并发控制ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'updateControlIdOd',
          label: '并发控制ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'transferOrderId',
          label: '展车主单id',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'transferOrderDId',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'partCode',
          label: '备件编码',
          align: 'center'
        },
        {
          prop: 'partName',
          label: '备件名称',
          align: 'center'
        },
        {
          prop: 'partQTY',
          label: '数量',
          align: 'center'
        },
        {
          prop: 'partPrice',
          label: '单价',
          align: 'center'
        },
        {
          prop: 'partSum',
          label: '费用合计',
          align: 'center'
        },
        {
          prop: 'partClaimWiCoef',
          label: '索赔系数',
          align: 'center'
        },
        {
          prop: 'partIsMain',
          label: '是否主备件',
          align: 'center'
        },
        {
          prop: 'partRemark',
          label: '备件',
          align: 'center'
        }
      ],

      tableCols3: [
        {
          prop: 'releaseId',
          label: '主键ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'updateControlIdO',
          label: '并发控制ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'updateControlIdOd',
          label: '并发控制ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'transferOrderId',
          label: '展车主单id',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'transferOrderDId',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'otherFeeName',
          label: '其他项目',
          align: 'center'
        },
        {
          prop: 'otherFee',
          label: '费用',
          align: 'center'
        },
        {
          prop: 'otherRemark',
          label: '备注',
          align: 'center'
        }
      ],
      callbackObj1: {
        // 手动勾选网格时，拿到勾选网格的数据
        onCheckSelect: (selection, row) => {
          this.selectiondata.list = selection
        },
        onCheckSelectAll: (selection) => {
          this.selectiondata.list = selection
        }
      },
      tableCols4:
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path] &&
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path].tableCols4 &&
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path].tableCols4
          .length > 0
          ? this.$ConfigCache.CacheConfig.cacheData[this.$route.path].tableCols4
          : [
            {
              prop: 'releaseId',
              label: '主键ID',
              hidden: true,
              alwaysHidden: true
            },
            {
              prop: 'updateControlIdO',
              label: '并发控制ID',
              hidden: true,
              alwaysHidden: true
            },
            {
              prop: 'updateControlIdOd',
              label: '并发控制ID',
              hidden: true,
              alwaysHidden: true
            },
            {
              prop: 'transferOrderId',
              label: '展车主单id',
              hidden: true,
              alwaysHidden: true
            },
            {
              prop: 'transferOrderDId',
              hidden: true,
              alwaysHidden: true
            },
            {
              prop: 'appealStatus',
              label: '审核结果',
              align: 'center'
            },
            {
              prop: 'auditMemo',
              label: '审核意见',
              align: 'center'
            },
            {
              prop: 'auditUser',
              label: '审核人',
              align: 'center'
            },
            {
              prop: 'auditDate',
              label: '审核时间',
              align: 'center'
            },
            {
              prop: 'auditRemark',
              label: '备注',
              align: 'center'
            }
          ],
      formField: {
        // claimCode: "", //索赔单
        // reverseCode: "", //倒扣单
      },

      tableCols5: [
        {
          prop: 'fileName',
          label: '附件名称',
          align: 'center'
        },
        {
          prop: 'carConfigCn',
          label: '备注',
          align: 'center'
        }
      ],

      formButtons: [
        {
          compKey: 'btnKey6',
          type: 'primary',
          size: 'small',
          name: 'reject',
          clickEvent: () => this.passOpen(2),
          text: this.$t('sys.button.reject'),
          position: 'right',
          fuzzySearch: true
        },
        {
          compKey: 'btnKey5',
          type: 'primary',
          size: 'small',
          name: 'pass',
          clickEvent: () => this.passOpen(1),
          text: this.$t('sys.button.pass'),
          position: 'right',
          fuzzySearch: true
        }
      ],

      // 标题
      textMap: {
        edit: '修改索赔申诉',
        view: '索赔申诉详情'
      },
      activeName: 'first', // tab栏默认项
      dataList: [],
      cIndex: 0
    }
  },
  watch: {
    'chooseList': {
      handler: function(val) {
        if (val) {
          const that = this
          const queryObj = {
            apiConfig: orgApis.findClaimDetail,
            variables: {
              claimId: that.chooseList[0].claimId,
              appealId: that.chooseList[0].appealId
            }
          }
          var paramD = that.$getParams(queryObj)
          that.$requestAPI(paramD).then((response) => {
            if (response.result === '1') {
              that.formField = response.rows[0]
              that.$refs['multipleTable4'].list = response.rows[0].claimInfo
              that.$refs['multipleTable5'].list = response.rows[0].fujianInfo
              that.$refs['multipleTable2'].list = response.rows[0].claimPart
              that.$refs['multipleTable3'].list = response.rows[0].claimOtherPart
              that.$refs['multipleTable1'].list = response.rows[0].claimProject
            } else {
              that.$message({
                message: response.msg,
                duration: 1000
              })
            }
          })
        }
      }
    }
  },

  created() {
  },

  mounted() {
  },

  methods: {
    // 点击取消，关闭审核意见弹框
    closeBack() {
      this.dialogFormVisible = false
      this.formField6.auditMemo = ''
    },
    // 打开审核意见弹框
    passOpen(num) {
      this.dialogFormVisible = true
      this.num = num
    },
    // 打开弹框时
    open() {
      const that = this
      if (this.popupsState == 'view') {
        that.formButtons = []
      } else {
        that.formButtons = [
          {
			    compKey: 'btnKey6',
			    type: 'primary',
            size: 'small',
            name: 'reject',
            clickEvent: () => this.passOpen(2),
            text: this.$t('sys.button.reject'),
            position: 'right',
            fuzzySearch: true
          },
          {
			    compKey: 'btnKey5',
			    type: 'primary',
            size: 'small',
            name: 'pass',
            clickEvent: () => this.passOpen(1),
            text: this.$t('sys.button.pass'),
            position: 'right',
            fuzzySearch: true
		    }
        ]
      }
      const queryObj = {
        type: 'mutation',
        apiConfig: orgApis.findClaimDetail,
        variables: {
          claimId: that.dynamicEditRowData.claimId,
          appealId: that.dynamicEditRowData.appealId,
          appealCode: that.dynamicEditRowData.appealCode
        }
      }
      var paramD = this.$getParams(queryObj)
      this.$requestAPI(paramD).then((response) => {
        if (response.result === '1') {
          that.formField = response.rows[0]
          that.$refs['multipleTable4'].list = response.rows[0].claimInfo
          that.$refs['multipleTable5'].list = response.rows[0].fujianInfo
          that.$refs['multipleTable2'].list = response.rows[0].claimPart
          that.$refs['multipleTable3'].list = response.rows[0].claimOtherPart
          that.$refs['multipleTable1'].list = response.rows[0].claimProject
        } else {
          this.$message({
            message: response.msg,
            duration: 1000
          })
        }
        // this.$emit("update:popupsVisible", false);
      })
    },

    // 附件下载
    addRow() {
      const that = this
      const queryObj = {
        apiConfig: orgApis.downloadFile,
        variables: that.selectiondata
      }
      var paramD = this.$getParams(queryObj)
      this.$requestAPI(paramD).then((response) => {
        if (response.result === '1') {
          this.$message({
            message: response.msg,
            duration: 1000
          })
          that.dialogFormVisible = false
        } else {
          this.$message({
            message: response.msg,
            duration: 1000
          })
        }
        // this.$emit("update:popupsVisible", false);
      })
    },

    submitTo() {
      const that = this
      const queryObj = {
        type: 'mutation',
        apiConfig: orgApis.claimAppealAudit,
        variables: {
          SsSubmit: that.num,
          claimID: that.formField.claimID,
          appealCode: that.dynamicEditRowData.appealCode,
          auditMemo: that.formField6.auditMemo
        }
      }
      var paramD = this.$getParams(queryObj)
      this.$requestAPI(paramD).then((response) => {
        if (response.result === '1') {
          this.$message({
            message: response.msg,
            duration: 1000
          })
          that.dialogFormVisible = false
        } else {
          this.$message({
            message: response.msg,
            duration: 1000
          })
        }
        // this.$emit("update:popupsVisible", false);
      })
    },
    closeEdit() {
      // this.resetOrderIcon();
      this.$emit('update:popupsVisible', false)
      this.$emit('close', false)
    },
    handleClick(tab, event) {
      console.log(tab, event)
    },

    // 上传附件
    handFileListChange(file, fileList) {
      this.handleChange(file)
    },
    handleChange(param) {
      const that = this
      const url = '/mp/file/commonUpload/upload.do'
      that
        .$requestUpload(url, param)
        .then((response) => {
          if (response.result === '1') {
            //  路径
            const attachmentFilePath = response.path[0][0].split('|')[1]
            // 文件名
            const fileName = response.path[0][0].split('|')[0]
            const dataParmas = { fileName, attachmentFilePath }
            that.dataForm = dataParmas
            that.$refs['multipleTable5'].list = [that.dataForm]
            that.addFilePath(dataParmas)
          }
        })
        .catch((err) => {})
    },
    // 上传附件
    addFilePath(dataParmas) {
      debugger
      const that = this
      dataParmas.appealId = that.dynamicEditRowData.appealId
      request({
        url: orgApis.claimAppealEnclosureAdd.APIUrl,
        method: 'post',
        data: dataParmas
      }).then((res) => {
        if (res.result == '1') {
          this.$message.success('上传附件成功')
        }
      })
    },

    // 清空
    resetData() {
      this.$utils.deepClone(this.formField)
      this.formField.carSeriesId = ''
      this.formField.carSeriesCn = ''
      this.formField.carConfigId = ''
      this.formField.carConfigCn = ''
      this.formField.optionalPagId = ''
      this.formField.optionalPagName = ''
      this.formField.carColorId = ''
      this.formField.carColorName = ''
      this.formField.carIncolorId = ''
      this.formField.carIncolorName = ''
      this.formField.cityId = ''
      this.formField.cityName = ''
      this.formField.deliveryDlrId = ''
      this.formField.deliveryDlrFullName = ''
      this.formField.dlrFullName = ''
      this.formField.dlrId = ''
      this.formField.orderNum = ''
      this.formField.remark02 = ''
    }
  }
}
</script>

<style lang="scss" scoped>
.filter-title {
  font-size: 18px;
  font-weight: bolder;
}
.filter-container.filter-title::before {
  border-left: 4px solid #0075ff;
  padding-right: 10px;
  height: 20px;
  left: 0px;
  top: 4px;
}

.btns-container {
		width: 100%;
		height: 30px;
		padding: 0 20px;
		background-color: #fff;
		.el-button {
			float: right;
      margin-right: 13px;
      margin-left: 0;
		}
	}
</style>
